﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VirtualTournaments.Services.Tournaments;
using System.Data.SqlClient;

namespace VirtualTournaments.Business.Tests.ServicesTests
{
    [TestClass]
    public class TestPlayersService
    {
        public TestPlayersService() { }

        private TestContext testContextInstance;

        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

		[TestMethod, Ignore]
        public void GetPlayersByTeamNameTest()
        {
            const String TEAM = "Independiente";
            const int PLAYERS_COUNT = 6; 
            const String GOALKEEPER = "Adrián Gabbarini";
            const String FORWARD = "Andrés Silvera";
            const String GOALKEEPER_ID = "GOALKEEPER";
            const String FORWARD_ID = "FORWARD";

            Player[] players = Services.Tournaments.PlayersService.GetPlayersByTeamName(TEAM);

            Assert.AreEqual (PLAYERS_COUNT, players.Count());
            
            Assert.AreEqual(GOALKEEPER, players[0].Name);
            Assert.AreEqual(GOALKEEPER_ID, players[0].Role);
            
            Assert.AreEqual(FORWARD, players[PLAYERS_COUNT - 1].Name);
            Assert.AreEqual(FORWARD_ID, players[PLAYERS_COUNT - 1].Role);
        }
    }
}
